﻿Public Class greades
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btn_getGrade_Click(sender As Object, e As EventArgs) Handles btn_getGrade.Click
        lbl_grade.Text = getResult(tb_marks.Text)
    End Sub

    Private Function getResult(ByVal percentageStr As String) As String
        Dim percentage As Single
        percentage = CSng(percentageStr)

        Select Case percentage
            Case Is > 70
                Return "A"
            Case Is > 60
                Return "B"
            Case Is > 50
                Return "C"
            Case Else
                Return ("F")
        End Select
    End Function
End Class